# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-google-search-api
pkgname=('python2-google-search-api' 'python-google-search-api')
_pkgname=Google-Search-API
pkgver=1.1.14
pkgrel=11
pkgdesc='Search in google.'
url='https://pypi.org/project/Google-Search-API/#files'
arch=('any')
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools' 'python2-pip' 'python-pip'
             'python2-wheel' 'python-wheel')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
        'setup.py.patch')
sha512sums=('1be83e693d695f98bbf108ece4f242ffcaf7c3aa64248d804f7c7b9cf3f10b5ef51d88c2fcf0dfbdbdbe48468cd3270071d4e3bf8bc32182dccafb83bc2ae513'
            '9eb086c78ab718236771e2e86dc556ef9ad52f4f88aec9d3e7ec723c510b6586897f16504157f052cd3ed57da634631abfb13005266252a16e07543c3c595a20')

prepare() {
  patch -p1 < setup.py.patch

  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-google-search-api() {
  depends=('python2' 'python2-beautifulsoup4' 'python2-requests'
           'python2-unidecode' 'python2-selenium' 'python2-vcrpy'
           'python2-future' 'python2-fake-useragent')

  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-google-search-api() {
  depends=('python' 'python-beautifulsoup4' 'python-requests' 'python-unidecode'
           'python-selenium' 'python-vcrpy' 'python-future'
           'python-fake-useragent')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

